import { nextTick, Ref } from "vue";

export const useDialog = (dialogRef: Ref) => {
  const open = async (flag?: any) => {
    await nextTick();
    dialogRef.value.open(flag);
  };
  const close = () => {
    dialogRef.value.close();
  };
  const openLoading = async (callback: () => void) => {
    await nextTick();
    dialogRef.value.openLoading(callback);
  };
  return { open, close, openLoading };
};
